package com.project.controller;

import com.project.bean.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class TestController {

    //客户端以/tt请求服务器，由该方法处理。
//    @RequestMapping("/tt")
    public String test(){
        System.out.println("访问到test方法");

        //当这个应用控制器处理完成以后，转发指定的页面
        return "/html/index.html";
    }

    @RequestMapping("/speak")
    public String speak(){
        System.out.println("speak");
        return "/html/speak.html";
    }

    @RequestMapping("/add")
    public void add(UserBean userBean, HttpServletResponse resp) throws Exception{

        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().print(userBean);
    }
}
